<?php
/*
Copyright 2008, Nathalia


Author:
Nathalia Sautchuk Patrício          (nathalia.sautchuk@gmail.com)

*/
class Finalizar extends TPage
{
	public function onInit($param)
    {
        parent::onInit($param);
        
        if(!$this->IsPostBack)  // if the page is requested the first time
        {
            // populates post data into the repeater
            $sql = "SELECT
                        Avaliacao.ArtigoID,
                        Artigo.Status,
                        CongressoID,
                        Titulo,
                        AVG(Nota) as Media
                    FROM Avaliacao
                    INNER JOIN Artigo ON Artigo.ArtigoID = Avaliacao.ArtigoID
                    WHERE CongressoID = ".$this->Request['CongressoID']."
                    GROUP BY Avaliacao.ArtigoID";

            //print_r(ResultadoRecord::finder()->findBySql($sql));die();
            $this->Repeater->DataSource = ResultadoRecord::finder()->findAllBySql($sql);
            $this->Repeater->dataBind();
        }
    }
}
?>
